﻿@using SPCFMedicineInformer.Helpers;
@using SPCFMedicineInformer.Constants;
@{
    var Index = UmbracoNodeHelper.GetAdminSiteNode();
    var Current = Model.AncestorOrSelf(3);
    string selected =  "id=\"submenu-active\"";
    <ul class="box">
        @foreach (var item in Index.ChildrenAsList.Where(a => a.NodeTypeAlias == "AdminContentPage" && a.GetProperty("umbracoNaviHide").ToString() == "0"))
        {
            <li @Html.Raw(item.Id == Current.Id ? selected: "")><a href="@item.Url">@item.Name</a></li>
            var itemList = item.ChildrenAsList.Where(a => a.NodeTypeAlias == "AdminContentPage" || a.NodeTypeAlias == "EmailTemplates");
            if (itemList.Count() > 0)
            {
                <ul>
                    @foreach (var child in itemList)
                    {
                        var childOrParent = Model.Id;
                      
                        <li><a href="@child.Url" @Html.Raw(childOrParent == child.Id ? "style=\"color:red;font-weight:bold;\"" : "")>@child.Name</a></li>                         
                    }
                </ul>
            }

        }
	</ul>
}